<template>
  <el-menu router :default-active="$route.path" class="el-menu-demo" mode="horizontal" @select="handleSelect"
    background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" menu-trigger="click" unique-opened>
    <el-menu-item index="0" disabled style="width:37%;cursor: default;" v-if="isAdministrator"></el-menu-item>
    <el-menu-item index="0" disabled style="width:40%;cursor: default;" v-else></el-menu-item>
    <el-menu-item index="/home">首页</el-menu-item>
    <el-menu-item index="/gameNews">游戏资讯</el-menu-item>
    <el-menu-item index="/gameGoods">游戏商城</el-menu-item>
    <el-submenu index="4">
      <template slot="title" disabled>我的</template>
      <el-menu-item index="/cart">购物车</el-menu-item>
      <el-menu-item index="/myOrder">我的订单</el-menu-item>
      <el-menu-item index="/updateUser">修改我的信息</el-menu-item>
      <el-menu-item index="/userInfo">查看个人信息</el-menu-item>
    </el-submenu>
    <el-submenu index="5" v-if="isAdministrator">
         <template slot="title" disabled>管理员</template>
      <el-submenu index="2-4">
        <template slot="title">用户管理</template>
        <el-menu-item index="/userRecharge">用户充值</el-menu-item>
        <el-menu-item index="/resetPassword">重置密码</el-menu-item>
      </el-submenu>
      <el-menu-item index="/gameGoodsAdmin">商品管理</el-menu-item>
      <el-submenu index="2-5">
        <template slot="title">订单管理</template>
        <el-menu-item index="/orderList">订单查询</el-menu-item>
        <el-menu-item index="/refund">退款处理</el-menu-item>
      </el-submenu>
    </el-submenu>
  </el-menu>


</template>

<script>
import { mapGetters } from "vuex";
export default {
  computed: {
    ...mapGetters(["isAdministrator"]),
  },
  data() {
    return {
      activeIndex: '1'
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      //console.log(key, keyPath);
    }
  }
}
</script>

<style>

</style>